home *** CD-ROM | disk | FTP | other *** search
- property velocity, previousFlag, mySprite
-
- on new me, listPosition
- set myListPosition to listPosition
- set mySprite to myListPosition + 9
- puppetSound(1, "boing")
- set previousFlag to 0
- set velocity to 10
- set the memberNum of sprite mySprite to the number of member "ball"
- set the locV of sprite mySprite to 60
- set the locH of sprite mySprite to random(250) + 40
- return me
- end
-
- on animateBall me
- if not (sprite mySprite within 6) then
- set flag to 0
- else
- set flag to 1
- end if
- if (flag = 1) and (previousFlag = 0) then
- set velocity to velocity * -1
- puppetSound(2, "bounce boing")
- else
- if (flag = 1) and (previousFlag = 1) then
- nothing()
- end if
- end if
- set flag to previousFlag
- set currentPosition to the locV of sprite mySprite + velocity
- if (currentPosition < 30) and (velocity < 0) then
- set velocity to -1 * velocity
- puppetSound(2, "bounce boing")
- end if
- if currentPosition > 270 then
- set currentPosition to -30 + (currentPosition - 240)
- end if
- set the locV of sprite mySprite to currentPosition
- end
-